package com.itheima.controller;

import com.itheima.daomain.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller

public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/user")
    public String save(){
        userService.save();
        return "index.jsp";
    }


    @RequestMapping("/user-json")
    @ResponseBody
    public User user_json(){
        User user=new User();
        user.setAge(1);
        user.setName("fdsafa");
        return user;

    }
}
